<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="utf-8">
    <meta name="format-detection" content="telephone=no">
    <meta name="viewport" content="initial-scale=1,user-scalable=no,maximum-scale=1,width=device-width">
    <title>运营商</title>
    <link href="../Content/css/style.css" rel="stylesheet">
    <script src="../Content/js/rem.js"></script>
    <style>

    </style>
</head>
<body>
<div id="loading">
    <img src="../Content/imgs/kbloading.gif">
</div>
    <div class="wrap">
        <div class="user-bind-card-verified">
            <ul class="steps">
                <li class="steps__item active"><span>1</span>
                    <p>个人信息</p></li>
                <li class="steps__item active"><span>2</span>
                    <p>芝麻信用</p></li>
                <li class="steps__item active"><span>3</span>
                    <p>运营商</p></li>
                <li class="steps__item"><span>4</span>
                    <p>京东</p></li>
            </ul>
            <p class="bind-card__tips">我们为您的信息提供安全加密,不会泄露给第三方.运营商数据分析,可能需要1-2个小时.如果验证失败,您所支付的验证费用将会退回.</p>
            <ul class="form-box">
                <li class="form__item"><span class="form__key">姓名</span>
                <div class="form__value"><input type="text" placeholder="请输入您的姓名" id="name"></div>
                </li>
                <li class="form__item"><span class="form__key">身份证号码</span>
                    <div class="form__value"><input type="text" placeholder="请输入您的身份证号" id="sfznum" maxlength="18"></div>
                </li>
                <li class="form__item"><span class="form__key">手机号码</span>
                    <div class="form__value"><input type="text" placeholder="请输入手机号" id="phone"></div>
                </li>
                <li class="form__item"><span class="form__key">手机服务密码</span>
                    <div class="form__value"><input type="text" placeholder="请输入手机服务密码" id="pass"></div>
                </li>
            </ul>
            <ul class="form-box dn" id="yzmbox">
                <li class="form__item"><span class="form__key">验证码</span>
                    <div class="form__value"><input type="text" placeholder="请输入运营商给你发送的短信验证码" id="yzmpass"></div>
                </li>
                <li>
                    <a href="javascript:;" class="tjyzm" onclick="tjyzm()">提交验证码</a>
                </li>
            </ul>

            <div class="bind-card-button"><span class="qrfbbtn" onclick="submit()">下一步</span></div>
        </div>
    </div>
    <script src="../Content/js/jquery-2.2.4.min.js"></script>
    <script src="../Content/js/layer-mobl.js"></script>
<script>
    var winH=$(window).height();
    $(".wrap").css("height",winH);
    $(function(){
//            $(".qrfbbtn").on('click',function () {
//                window.location.href="jingdong.html"
//            });
        $("#loading").hide();
    });
    var toke="";
    function submit() {
        var sfz=$("#sfznum").val();
        var phone=$("#phone").val();
        if($("#name").val()==""){
            layer.open({
                content:"姓名不能为空",
                time:1
            });
            return false;
        }else if(!/(^\d{15}$)|(^\d{18}$)|(^\d{17}(\d|X|x)$)/.test(sfz)){
            layer.open({
                content:"身份证输入有误~",
                time:1
            });
            return false;
        }else if(phone.length!=11){
            layer.open({
                content:"手机号输入有误",
                time:1
            });
            return false;
        }else if($("#pass").val()==""){
            layer.open({
                content:"输入服务密码",
                time:1
            });
            return false;
        }

        $.ajax({
            type : "GET",
            url : localStorage.url+"/yys/opereportOne",
            data :{
                realname:$("#name").val(),
                mobileno:$("#phone").val(),
                password:$("#pass").val(),
                idcard:$("#sfznum").val()
            },
            success : function(datas) {
                console.log(datas);
                if(datas.data=="1"){
                    cx(datas.token);
                    toke=datas.token;

                }else {
                    layer.open({
                        content:"查询失败,请重试!",
                        time:1
                    })
                }

            },
            error : function(err) {
                //console.log(err);
            }
        });
    }

    function cx(tokenv) {
        $.ajax({
            type : "GET",
            url : localStorage.url+"/yys/status",
            data :{
                token:tokenv,
                id:localStorage.id
            },
            success : function(datas) {
                console.log(datas);
                if(datas.data=="2"){
                    $("#yzmbox").show();
                    $(".bind-card-button").hide();
                }else if(datas.data=="1"){
//                    layer.open({
//                        content:"查询成功!",
//                        time:1
//                    })
                    layer.open({
                        content:"数据查询中,可能需要较长时间,您可以关闭此页面进行其他操作!",
                        time:10
                    })
                }
                else {
                    layer.open({
                        content:"查询失败,请重试!",
                        time:1
                    })
                }
            },
            error : function(err) {
                //console.log(err);
            }
        });
    }

    function tjyzm() {
        if($("#yzmpass").val()=="" ||$("#yzmpass").val().length>6){
            layer.open({
                content:"请正确输入验证码~",
                time:1
            })
        }
        $.ajax({
            type : "GET",
            url : localStorage.url+"/yys/yzm",
            data :{
                token:toke,
                smsCode:$("#yzmpass").val()
            },
            success : function(data) {
                console.log(data);
                if(datas.data=="0"){
                    layer.open({
                        content:"验证码验证失败!",
                        time:1
                    })
                }else if(datas.data=="1"){
                    layer.open({
                        content:"数据查询中,可能需要较长时间,您可以关闭此页面进行其他操作!",
                        time:10
                    })
                    cx(toke)
                }
                else {
                    layer.open({
                        content:"查询失败,请重试!",
                        time:1
                    })
                }
            },
            error : function(err) {
                //console.log(err);
            }
        });
    }

</script>
</body>
</html>
